<%--
  Created by IntelliJ IDEA.
  User: Dell
  Date: 2018/12/11
  Time: 16:27
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="PageFrame.jsp" %>

<link rel="stylesheet" type="text/css" href="../css/magicBtn.css"/>
<link rel="stylesheet" href="../css/style-loading.css" type="text/css"/>
<script src="../js/magicBtn.min.js" type="text/javascript"></script>
<script src="../js/download.js" type="text/javascript"></script>

<title>数据下载-QM/MM数据下载</title>

<!-- Page Content -->
<div class="container background_form" id="search_QM">
    <div class="content">

        <div id="qm_show_panel">
            <table id="table_dataset_list" class="table table-bordered">
                <thead style="background-color: #f3f3f3;">
                <tr>
                    <th style="width: 25%">数据集</th>
                    <th style="width: 25%">上传者</th>
                    <th style="width: 25%">类型</th>
                    <th style="width: 25%">下载</th>
                </tr>
                </thead>
                <tbody>
                </tbody>
            </table>
        </div>
    </div>
</div>
<!-- /Page Content -->

<!-- js-->
<%--load_dataset_list--%>
<script type="text/javascript">
    document.ready = function () {
        load_dataset_list();
    }

    function load_dataset_list() {
        $.ajax({
            url: 'get_dataset_list',
            type: 'GET',
            success: function (returndata) {
                if (returndata.replace(/[\r\n]/g, "") !== "") {

                    var table = document.getElementById('table_dataset_list');
                    var tbody = table.children[1];
                    var childrenNum = tbody.children.length;
                    for (var i = 0; i < childrenNum; i++) {
                        tbody.removeChild(tbody.children[0]);
                    }
//                        写入数据
                    var search_result_arr = returndata.split("wlcniubi");
                    for (var i = 0; i < search_result_arr.length; i++) {
                        var row_arr = search_result_arr[i].split("lxyniubi");
                        create_table_row(row_arr, i);
                    }
                } else {
                    alert("Data not found");
                }
            },
            error: function (returndata) {
                alert("loading dataset fail!");

            }
        });

    }

    function download_file(name) {
        $.ajax({
            url: 'dataset_download',
            type: 'GET',
            data: {dataset_name: name},
            success: function (ret) {

            },
            error: function (ret) {
                alert("loading dataset fail!");
            }
        });

    }


</script>
